package de.andreavicentini.teatralia.generate;

import org.magiclabs.htmlx.*;
import de.andreavicentini.teatralia.pages.events.*;
import de.andreavicentini.teatralia.pages.*;
import de.andreavicentini.teatralia.pages.repertoire.*;
import java.util.*;

public class Events implements ITransfx {
  protected static String nl;
  public static synchronized Events create(String lineSeparator)
  {
    nl = lineSeparator;
    Events result = new Events();
    nl = null;
    return result;
  }

  public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
  protected final String TEXT_1 = "";
  protected final String TEXT_2 = NL + NL + NL + "<p class=\"intro\">";
  protected final String TEXT_3 = "</p>" + NL;
  protected final String TEXT_4 = NL;
  protected final String TEXT_5 = NL;
  protected final String TEXT_6 = NL;

	public String generate(Object argument)
  {
    final StringBuffer stringBuffer = new StringBuffer();
    stringBuffer.append(TEXT_1);
      
EventsPage page = (EventsPage) argument;
TeatraliaSiteModel site = (TeatraliaSiteModel) page.getArea().getSiteModel();
EventRenderer renderer = new EventRenderer();

    stringBuffer.append(TEXT_2);
    stringBuffer.append( page.getText(EventsPage.Keys.intro) );
    stringBuffer.append(TEXT_3);
     for (Event event : page.iterateEvents()) {  
    stringBuffer.append(TEXT_4);
    stringBuffer.append( renderer.generate(page, event)  );
     } 
    stringBuffer.append(TEXT_5);
    stringBuffer.append(TEXT_6);
    return stringBuffer.toString();
  }
}